Author :

I have form to edit/upload image in Laravel Project. <form action=”{{ route(‘picture.update’,$animal->sid) }}” enctype=”multipart/form-data” method=”POST”> <div class=”form-group”> <label class=”form_group_title”>Image</label> <img id=”file-image” src=”{{asset(‘/images’)}}/{{$animal->image}}” alt=”Preview” class=”hidden img-thumbnail”> <input id=”file-upload” type=”file” name=”image_upload” accept=”image/*” class=”hidden” onchange=”readURL(this);”> <label for=”file-upload” id=”file-drag”> <span class=”btn btn-light”>Select</span> </label> <div id=”start”> <i class=”fa fa-download” aria-hidden=”true”></i> <span class=”text-danger”>{{ $errors->first(‘image_upload’) }}</span> </div> </div> </form> <script> function readURL(input, ..

Read more

In his life, he only encountered an ajax 2 times and here again our paths intertwined with him and he gave me 422 errors. I googled and realized that 422 error is a validation error, but in what specific place the error, I just can not understand. This is my script <script type=”text/javascript”> $.ajaxSetup({ headers: ..

Read more

I tried to attach facebook login in laravel project. I created facebook app in my facebook develop account and installed socialite package in laravel project and implemented all necessary code(controller and model ) and database of course I set FACEBOOK_CLIENT_ID and FACEBOOK_CALLBACK_URL in .env file But when I click the facebook login button, error happens. ..

Read more

Looking at composer.json file in laravel project, I can find below “autoload”: { “psr-4”: { “App”: “app/” }, “classmap”: [ “database/seeds”, “database/factories” ] }, as far as I know App:”app/” means a name space starts with App has its source files under the app/ directory and it follows psr-4. however, there are ton’s of packages ..

Read more

I want to use pagination after getting my data from api resource But the server responds: Method IlluminateDatabaseEloquentCollection::pagination does not exist. public function index(Request $request ) { $perPage=$request->per_page; return response()->json([‘user’=>UserResource::collection(User::with(‘roles’)->get()->pagination($perPage))],200); } Source: Laravel Sta..

Read more

<div class=”float-right”> <form> <div class=”form-group row”> <div class=”col-sm-12″> <select class=”form-control” id=”select_id” > <option> Choose Class </option> @foreach($allclass as $classs) <option value=”{{$classs->id}}”> {{$classs->class}} </option> @endforeach </select> </div> </div> </form> </div> This is Where user choose Class and when user choose the class i want to view data as per the class . class SectionController extends Controller ..

Read more

User Model public function teachers() { return $this->hasMany(Teacher::class); } Teacher Model public function user(){ return $this->belongsTo(User::class); } TeacherController public function index() { $role_user = DB::table(‘roles’)->where(‘role’, ‘teacher’)->first(); $role_id = $role_user->id; $users = User::all()->where(‘role_id’,$role_id); return view(‘admin.teacher.index’) ->with(‘users’,$users); } In View <td class=”d-none d-sm-table-cell”>{{dd( $teacher->teachers->designation)}}</td> It Gives An Error like this Property [designation] does not exist on this ..

Read more

I’m going to get data from a database using axios. Props was announced as follows: <script> export default { props:[‘data’], } </script> <v-flex xs8> <question v-for=”question in questions” :key=”question.path” :data=question ></question> </v-flex> And During data connect router-link there were some issues. <h3 class=”headline mb-0″> <router-link :to=”data.path”> {{ data.title }} </router-link> <!– <router-link to=”data.path”> {{ data.title ..

Read more

I have web.php with $router->namedRoutes[‘c_k’] = $router->post(‘/c_k’, [‘uses’ => ‘[email protected]’]); in it. Also there is BController with cK method. Then, I have AController. In AController is action g_k. The problem: client makes get-request to g_k action in AController, and I want to redirect it to c_k action(it’s post, u remember?) of BController with some json ..

Read more

laravel session missing after refresh url take with get parameter This is my parameters ?query%5Bdevice_id%5D=&query%5Boperator_id%5D=&query%5Bcreated_at%5D=2017-11-15+00%3A00%3A00 after web load finish.refresh this web,I found this connection will get a new session, I can not get data which in the last session . So ,should I change my url or need change c..

Read more

Laravel – referencing the class I’ve been reading a lot of documentation for Laravel during last week for the sake of learning what kind of beast it is. I noticed one thing that whenever somebody references some class he references to it as string, e.g.: public function user() { return $this->belongsTo(‘AppUser’); } Pay attention to ..

Read more

Laravel phpunit returns 404 i am new in Laravel. Using local development environment with Homestead Try to run simple test namespace TestsFeature; use TestsTestCase; use IlluminateFoundationTestingRefreshDatabase; class UserTest extends TestCase { /** * A basic test example. * * @return void */ public function testBasicTest() { $response = $this->get(‘/’); $response->assertStatus(200); } } routes/web.php : Route::get(‘/’, ..

Read more

I made comments function but it doesn’t work I made Comment function but it doesn’t work. It makes POST packets well but it doesn’t make any query to db. So the table is empty. Below is my source code CommentController.php <?php namespace AppHttpControllers; //171029 use IlluminateHttpRequest; use App; class CommentsController extends Controller { public function ..

Read more

Laravel error TokenMismatchException& I try to register user(using angular js).This is my form:register.blade.php <div class=”panel-footer” id=”free-panel-footer”> <form name=”registerCtrl.registerForm” ng-submit=”registerCtrl.submit(registerCtrl.registerForm.$valid)” novalidate class=”register-form” autocomplete=”off”> <input type=”hidden” name=”_token” value=”<?php echo csrf_token(); ?>”> …. In head index file i put this: <meta name=”csrf-token” content=”{!! csrf_token() !!}”> but i got error TokenMismatchException in compiled.php line ..

Read more

Multiple table joins and using only one blade for results I’m using Laravel 5.4 to create a project. I’m using these 3 tables with that relation. At my home page I’m doing a foreach on 9 elements. And everything is working fine there. This is my route: Route::get(‘/home’, ‘[email protected]’)->name(‘home’); Route::get(“/game/{id_g}”,”[email protected]”); Route::get(“/game/{id_g}”,”[email protected]”); My controller: public function ..

Read more

Voyager multiplay upload images in posts Laravel Version: 5.5 Voyager Version: 1.0 PHP Version:7.0 Database Driver & Version:MariaDB-10.1 Description: Hi guys, I do not understand how to do it so that I could add a few pictures to the post. I create a table that will store in itself id_post and url_image. But I do ..

Read more

Error related to only_full_group_by when executing a query in HeidiSQL I want to create a view in my DB, and below are my code and Error message Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘ucarer_server.ord_order.request_patient_id” which is not functionally dependent on columns in GROUP BY clause; this ..

Read more

This is my code. namespace AppConsoleCommands; use IlluminateConsoleCommand; use IlluminateSupportFacadesRedis; use AppEventsRedisEvent; class RedisSubscribe extends Command { protected $signature = ‘redis:subscribe’; protected $description = ‘Subscribe redis channel for socket communication’; protected $redisSubClient; protected $redisCacheClient; public function __construct() { parent::__construct(); $this->redisSubClient = Redis::connection(‘redis_socket_sub’); $this->redisCacheClient = Redis::connection(‘redis_cache’); } public function handle() { $this->redisSubClient->subscribe([‘fromClient’], function($data) { if($this->redisCacheClient->get(config(‘lunachat.yellow_id’).’_socket_mode’) == ..

Read more