المشاركات

How to send SMS using firebase in laravel

I am developing a laravel application,in which while user register, i want to send the registration code through SMS, i don't want to use any paid services.I heard about firebase free SMS gateway. Is there any option to send SMS through firebase from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32S92Gv via IFTTT

Why Laravel Sanctum SPA Authentication always keep the user logged in?

I used Laravel Sanctum SPA authentication. I can log out the user but I am wondering why is it that the user is still logged in even when I close the browser. I don't even implement the remember me function. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3faF5q7 via IFTTT

Relation query undefined method

In my setting model class i have this public function user() { return $this->hasMany('App\User'); } and in my user model class i have this public function settings() { return $this->belongsTo('App\settings', 'id'); } I tried both these queries, trying to get the user information but failed. $data = DB::table('settings') ->where('id', '=', $id) ->get() ->toArray(); and $table = \App\settings::where('id', '=', $id); $query = $table->user() ->get() ->toArray(); I'm getting this error Call to undefined method Illuminate\Database\Eloquent\Builder::user() How do you do relation query? Sorry new to laravel here. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35H8wNH via IFTTT

Store data into database using request json string in laravel

I am having a table name Student ( id , name , division ). To store data into this table I am sending json string as a request to the api in laravel. Request json string is, { "name":"abc", "division":"a", "city":"xyz" } Controller Code public function registerStudent(Request $request){ $requestData = $request->json()->all(); $studentModel = Student::create($requestData); } Student Model class Student extends Model { protected $fillable = [ 'id', 'name','division' ]; } When i execute this code , i get the following error, Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'city' in 'field list' (SQL: insert into `Student`... now my question here is, in what way I can store the data into database from json request with having extra keys into json object/array. from Newest questions tagged laravel-5 - Stack Overflow...

Laravel route not found when route exists

When I try to access my laravel site I get this error in the console. Laravel development server started: <http://127.0.0.1:8000> [Mon Nov 16 10:39:15 2022] PHP Fatal error: Uncaught InvalidArgumentException: Route [home] not defined. in /Users/threeaccents/code/src/gitlab.com/few/bodylove/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:389 Stack trace: #0 /Users/threeaccents/code/src/gitlab.com/few/bodylove/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(822): Illuminate\Routing\UrlGenerator->route('home', Array, true) #1 /Users/threeaccents/code/src/gitlab.com/few/bodylove/storage/framework/views/e071ac62e490c49233841ae8b6b3906075bc0187.php(6): route('home') #2 /Users/threeaccents/code/src/gitlab.com/few/bodylove/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include('/Users/threeacc...') #3 /Users/threeaccents/code/src/gitlab.com/few/bodylove/vendor/laravel/framework/src/Illuminate/View/Engine...

laravel validation, how to add validation rule on client side?

//html code <form> <input type="radio" id="defult" name="price_type" value="default"> <label for="defult">Default Price</label><br> <input type="radio" id="custom" name="price_type" value="custom"> <label for="custom">Custom Price</label><be> <input placeholder="Custom Price" class="form-control" name="custom_price"> </form> $('input[type=radio][name=price_type]').change(function() { if (this.value == 'default') { //make custom_price optional } else if (this.value == 'custom') { //make custom_price required } }); Actually, I have a radio box for the custom price or default price, if the user selects the custom price then want to make input[name=custom_price] required or if the user selects default price then make input[name=custom_price]...

my project laravel when i click submit in form with errors in input my view refresh multiple time so i can't see message errors

this my view code here i try to do form with validate and div with type of errors: @if(count($errors) > 0) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li></li> @endforeach </ul> </div> @endif <form action="add" method="POST"> <!--Securite--> Product name <input type="text" value="" class="form-control " name="name" placeholder="enter product"> <br> Product Price <input type="text" class="form-control " value="" name="price" placeholder="enter price"> <br> <input type="submit" value="Add Product"> </form> @endsection from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32QQuGF via IFTTT