laravel-5.4

How to create Tamil Language Based Web Application in Laravel 5.4

僤鯓⒐⒋嵵緔 提交于 2019-12-06 16:13:05
I planed to create Departmental Store Laravel Web Application in Tamil Language Not Using English. How to do it? You can create web apps using laravel's Localization. For that, you need to create language strings. Language strings are stored in files within the resources/lang directory. You need to create locale: Route::get('welcome/{locale}', function ($locale) { App::setLocale($locale); // }); Then create file within that directory and save it messages.php name like this: <?php return [ 'welcome' => 'Welcome to our application' ]; ?> Then you need to use this as in any blade file like: @lang

How to order data twice. But make the firts orderBy ineffective

主宰稳场 提交于 2019-12-06 06:09:47
I'm trying to get last 100 posts from database and than order them by likecount or another property and output only 5 of them, that way I will discover most liked 5 posts or viewed, or reported out of last 100 posts. What I tried so far is like below: $lastHundredPost = Post::orderBy('id', 'desc')->take(100); $post = $lastHundredPost->orderBy('likecount', 'desc')->take(2)->get(); this does not disable first orderBy property. Laravel 5.4 If you want to get result from the first query, use collections: $lastHundredPost = Post::orderBy('id', 'desc')->take(100)->get(); $post = $lastHundredPost-

Select Selected value of a dropdown in laravel 5.4

倾然丶 夕夏残阳落幕 提交于 2019-12-06 05:27:35
问题 I have a dropdown called designation, where a user will select one of it, and after submitting it, if there is some error then I want to select the selected designation. I am using this in laravel 5.4. Controller $info = DB::table("designation") ->where('status','=',1) ->pluck("name","id"); return view('regUser.add',['check' => 'userList','designation' => $info]); View Files <div class="form-group {{ $errors->has('designation') ? ' has-error' : '' }}"> <label for="designation">Designation<

Laravel 5.4 Migration Error

独自空忆成欢 提交于 2019-12-06 03:51:44
问题 I am facing a issue that I cannot resolve. I have my app hosted on my server using Ubuntu 16.04, PHP 7.1, MySQL and NGINX. My app works perfect. When I ssh to my server and app root I run the following, php artisan session:table, it runs successfully. When i run php artisan migrate I get foll0wing error and table is not created in my DB. [Illuminate\Database\QueryException] could not find driver (SQL: select * from information_schema.tables where t able_schema = UNIT3D and table_name =

How to use Console Kernel in Laravel PHP?

被刻印的时光 ゝ 提交于 2019-12-06 03:33:43
问题 I am reading the documentation at Laravel under the heading Architecture Concepts . I am unable to understand application and usage of Console Kernel .(not the Http Kernel) However, I googled out and found these links https://laravel.com/api/5.2/Illuminate/Foundation/Console/Kernel.html https://laravel.com/api/5.3/Illuminate/Contracts/Console/Kernel.html But I can't understand anything with that API ! 回答1: The HTTP Kernel is used to process requests that come in through the web (HTTP).

Cache table values globally in laravel

六眼飞鱼酱① 提交于 2019-12-06 03:03:36
I have a table: settings with the model Setting class Setting extends Model { protected $fillable = [ 'name', 'value', ]; } I have created a service provide SettingsServiceProvider and registered in app.php class SettingsServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot(Factory $cache, Setting $settings) { if (\Schema::hasTable('settings')) { config()->set('settings', Setting::pluck('value', 'name')->all()); } } /** * Register the application services. * * @return void */ public function register() { } } After adding

Change default laravel email template theme sent to gmail or hotmail

大城市里の小女人 提交于 2019-12-06 03:02:54
This is default email generated and sent by laravel using smtp , and i want to change this default template like adding some pictures,url... how can i do that? thanks Run php artisan vendor:publish and navigate to resources/views/vendor/notifications then now you have two files, edit them. While generating the auth using make:auth , it will generate the required views in the resources/view/auth folder. You can customize the resources/views/auth/emails/password.blade.php page as you required. You can add images and url as asked for more details here is the documentation 来源: https:/

laravel-5.4 - error :Creating default object from empty value

ぐ巨炮叔叔 提交于 2019-12-06 00:44:50
问题 I want to store image path in database. My Controller code under vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php follows: public function register(Request $request) { $this->validator($request->all())->validate(); if($request->hasFile('image')) { $image_name = $request->file('image')->getClientOriginalName(); $image_path = $request->file('image')->store('public'); $user->image = Storage::url($image_name); $user->save(); } event(new Registered($user = $this->create(

How to set default postgresql schema for laravel?

心已入冬 提交于 2019-12-06 00:04:21
I created new postgresql user: CREATE ROLE lara_user SUPERUSER LOGIN PASSWORD 'mypassword'; Then create schema which is owned by this user CREATE schema lara AUTHORIZATION lara_user; In Laravel's .env file I have DB_DATABASE=postgres DB_USERNAME=lara_user DB_PASSWORD=mypassword Laravel don't sees schema lara and still connected to public schema. How can I change and set default schema lara for Laravel ? in app/config/database.php 'pgsql' => array( 'driver' => 'pgsql', 'host' => 'localhost', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'prefix' => '',

Command “tinker” is not defined

本小妞迷上赌 提交于 2019-12-05 21:41:10
After upgrade from 5.3 to 5.4, Follow the instructions: In order to continue using the tinker Artisan command, you should also install the laravel/tinker package: composer require laravel/tinker Once the package has been installed, you should add" Laravel\Tinker\TinkerServiceProvider::class to the providers array in your config/app.php configuration file. After hours of search..got this question but is not working. Any ideas? config.json { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": {