lundi 1 janvier 2018

How can i pass angularjs variable to laravel name route?

I have a date picker and i want to get that that and pass to laravel route. how can i do that? My blade file:

<div class="form-inline">
               <label>Date:</label>
                <input class="form-control datePicker" type="text" name="date" id="date" ng-model="date">

 <a target="_blank" href="])}}">PDF</a>
            </div>

my route:

 Route::get('my/report/{date}','MyController@geteport')->name('my-report');

it it not working!



via Chebli Mohamed

How to search by starting word in laravel eloquent

I want to search from database by the first letter.

public function search_item(Request $request){
    $search_item = $request->search;

    $wheels = Wheel::where('wheel_name', 'like' , $search_item."%")->get();
}   



via Chebli Mohamed

Laravel create customs packages with commands

I am looking to make a generic appointment system in Laravel and I want to use that in my other projects. Is there any way to achieve by creating custom commands? For example, php artisan make:auth creates a complete login, register, forgot and reset password functionality. I want to do the same, like php artisan appoitment : make and it should create the models, controllers and database migrations in that Laravel installation



via Chebli Mohamed

What kind of Laravel concepts i need to understand to be a good professional laravel developer?

I am a laravel developer and want to ask what kind of laravel concepts i need to understand to grow as a professional laravel developer ! Also tell me is it compulsory to have a good grip on core php to be a good laravel developer?



via Chebli Mohamed

Reply Emails from Laravel

I receive Emails from Laravel with php-imap/php-imap
and I want to reply Emails from Laravel and when I send Email from laravel.
Laravel sent it on new Email not reply to it;



via Chebli Mohamed

Redirect to a Controller Action

I'm using Laravel 5.5.

My objective is to redirect to another method on the same controller to display a view with data.

class SeancesController extends Controller {

     public function getRecommandations(Request $request) {

          ...

          $data = [ ... ];
          return redirect()->action('SeancesController@showRecommandations', $data);
     }

     public function showRecommandations(Request $request) {
          return view('listeRecommandations', $request->data);
     }
}

It is the right way to do this? Because I get this error :

InvalidArgumentException: Action App\Http\Controllers\SeancesController@showRecommandations not defined. in file /home/nicolas/public_html/M1_CSI/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 338

I need to use action because I use an ajax call to access at getRecommandations() (and if I return the view, it is returned at the ajax call).

I used this doc : http://ift.tt/1SbcaSQ.

Thank's for help!



via Chebli Mohamed

Load db data into javascript file

I am using Laravel 5.5 and I am trying to work with ag-grid and want to load my data that is coming from my db directly into the Javascript file.

My Migration looks like the following:

public function up()
{
    Schema::create('tasks', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->timestamps();
    });
}

My Frontend looks like the following:

example.js

// specify the columns
var columnDefs = [
    {headerName: "Name", field: "name"},
    {headerName: "Created_At", field: "created_at"},
    {headerName: "Updated_At", field: "updated_at"}
];

// specify the data
var rowData = [
    {name: "TODO 1", created_at: "01.01.2018", updated_at: "05.11.2016"},
    {name: "TODO 1", created_at: "01.01.2018", updated_at: "05.11.2016"} // HERE I would like to replace this dummy data with my db data
];

// let the grid know which columns and what data to use
var gridOptions = {
    columnDefs: columnDefs,
    rowData: rowData,
    onGridReady: function () {
        gridOptions.api.sizeColumnsToFit();
    }
};

// used in our jasmine test
function selectAllRows() {
    gridOptions.api.selectAll();
}

// wait for the document to be loaded, otherwise ag-Grid will not find the div in the document.
document.addEventListener("DOMContentLoaded", function () {
    // lookup the container we want the Grid to use
    var eGridDiv = document.querySelector('#myGrid');

    // create the grid passing in the div to use together with the columns & data we want to use
    new agGrid.Grid(eGridDiv, gridOptions);
});

home.blade.php

<html>

<head>
    <script src="http://ift.tt/2C74JYM"></script>
    <script src="example.js"></script>
</head>

<body>
    <h1>Ag-Grid Example</h1>
    <div id="myGrid" style="height: 115px;width:500px" class="ag-fresh"></div>

    <!-- Own Scripts -->
    <script src=""></script>
</body>

</html>

Any suggestions how to insert my data that I load from the database into the the variable rowData in my example.js file?

I appreciate your replies!



via Chebli Mohamed